<script>
export default {
  name: "MySchool",
  props:{
    getSchoolName: Function
  },
  data() {
    return {
      name: "武汉大学",
      address: "武汉"
    }
  },
  methods:{
    sendSchoolName() {
      this.getSchoolName(this.name)
    }
  }
}
</script>

<template>
  <div class="school">
    <h2>学校名称:{{ name }}</h2>
    <h2>学校地址:{{ address }}</h2>
    <button @click="sendSchoolName">发送学校名称</button>
  </div>
</template>
<style scoped>
.school {
  background-color: pink;
  padding: 5px;
  margin-top: 30px;
}
</style>